
#ifndef Q3O_TYPES_H_
#define Q3O_TYPES_H_

#include <string>
#include <iostream>
#define _DEBUG
using namespace std;

		class Q3O_VERTEX{
			public:
			float xyz[3];
			~Q3O_VERTEX()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_VERTEX__"<<endl;
#endif
			}
		};

		class Q3O_FACE{
			public:
			int *vertices;
			unsigned char flags;
			Q3O_FACE()
			{
				vertices = NULL;
				flags = 0x0;
			}
			~Q3O_FACE()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_FACE__"<<endl;
#endif
				delete []vertices;
			}
		};


		class Q3O_TEX_UV{
			public:
			float uv[2];
			~Q3O_TEX_UV()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_TEX_UV__"<<endl;
#endif
			}
		};

		class Q3O_PIXEL{
			public:
			unsigned char color[3];
			~Q3O_PIXEL()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_PIXEL__"<<endl;
#endif
			}
		};
	

		class Q3O_HEADER{
			public:
			char signature[8];
			char version[2];
			int  numberMeshes;
			int  numberMaterials;
			int  numberTextures;
			~Q3O_HEADER()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_HEADER__"<<endl;
#endif
			}
		};



		class Q3O_CHUNK_HEADER {
			public:
			char type;
			~Q3O_CHUNK_HEADER()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_CHUNK_HEADER__"<<endl;
#endif
			}
		};

		class Q3O_MESH {
			public:
			long   numberVertices;
			Q3O_VERTEX *vertices;
			long   numberFaces;
			short  *faceShapes;
			Q3O_FACE   *faces;
			unsigned int    *materialIndices;//anzahl maximal anzahl faces
			long   numberNormals;
			Q3O_VERTEX *normals;
			long   numberTextureCoordinates;
			Q3O_TEX_UV  *textureCoordinates;
			Q3O_FACE   *textureIndices;//anzahl maximal anzahl faces
			Q3O_VERTEX centerOfMass;
			float  boundingBox[6];
			Q3O_MESH()
			{
				vertices = NULL;
				faceShapes = NULL;
				faces = NULL;
				materialIndices = NULL;
				normals = NULL;
				textureCoordinates = NULL;
				textureIndices = NULL;
			}
			~Q3O_MESH()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_MESH__"<<endl;
#endif
				delete []vertices;
				delete []faceShapes;
				delete []faces;
				delete []materialIndices;
				delete []normals;
				if( textureCoordinates != NULL )
					delete []textureCoordinates;
				if( textureIndices != NULL )
					delete []textureIndices;
			}
		};

		class Q3O_MATERIAL {
			public:
			string materialName;
			Q3O_VERTEX  ambientColor;
			Q3O_VERTEX  diffuseColor;
			Q3O_VERTEX  specularColor;
			float  transparency;
			int 	textureIndices;
			~Q3O_MATERIAL()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_MATERIAL__"<<endl;
#endif
			}
		};

		class Q3O_TEXTURE {
			public:
			string textureName;
			int    textureWidth;
			int    textureHeight;
			int    xRepeat;
			int    yRepeat;				
			Q3O_PIXEL  *texture;
			Q3O_TEXTURE()
			{
				texture = NULL;
			}
			~Q3O_TEXTURE()
			{
#ifdef DEBUG
				cout<<"__DESTRUCTOR__Q3O_TEXTURE__"<<endl;
#endif
				delete []texture;
			}
		};

#endif /*Q3O_TYPES_H_*/
